<template>
  <h1>用户ID为: {{ $route.params.id }}</h1>
  <RouterLink :to="{ path: '/home' }">回到首页</RouterLink>
</template>

<script setup>
  import { onBeforeRouteLeave } from "vue-router";

  // onBeforeRouteLeave((to, form, next) => {
  //   alert("您正在离开用户页面!");
  //   next();
  // });
</script>
